/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.velocityme.entity;

import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

/**
 *
 * @author rcrida
 */
@Entity
@NamedQuery(name="findAllContactables",
            query="SELECT o FROM Contactable o WHERE o.deleted = FALSE")
public class Contactable extends Node {
    private static final long serialVersionUID = 1L;

    @OneToMany(cascade = CascadeType.ALL)
    Collection<ContactDetail> contactDetails;

    @ManyToMany(mappedBy = "responsibleContactables")
    Collection<Task> responsibleTasks = new ArrayList<Task>();

    @ManyToMany(mappedBy = "interestedContactables")
    Collection<Task> interestedTasks = new ArrayList<Task>();

    protected Contactable() {
    }

    public void setInterestedTasks(Collection<Task> interestedTasks) {
        this.interestedTasks = interestedTasks;
    }

    public void setResponsibleTasks(Collection<Task> responsibleTasks) {
        this.responsibleTasks = responsibleTasks;
    }

    public Collection<Task> getInterestedTasks() {
        return interestedTasks;
    }

    public Collection<Task> getResponsibleTasks() {
        return responsibleTasks;
    }

    public Contactable(Node parentNode, String name, String description) {
        super(parentNode, name, description);
    }

    public Collection<ContactDetail> getContactDetails() {
        return contactDetails;
    }

    public void setContactDetails(Collection<ContactDetail> contactDetails) {
        this.contactDetails = contactDetails;
    }

}
